import { getNotToken } from '../utils/request.js';

export default {
    namespaced: true,
    state: {},
    mutations: {},
    actions: {
        // 获取轮播图
        getCarousel() {
            return new Promise((resolve, reject) => {
                getNotToken('/carousel?project_id=6')
                    .then(res => {
                        resolve(res.data);
                    })
                    .catch(err => {
                        reject(err);
                    });
            });
        },
        // 获取商品列表
        getGoods({ state }, { project_id, page, limit, classify_id }) {
            return new Promise((resolve, reject) => {
                // /goods?project_id=${project_id}&page=${page}&limit=${limit}&classify_id=${classify_id}
                getNotToken(`/goods?project_id=${project_id}&page=${page}&limit=${limit}&classify_id=${classify_id}`)
                    .then(res => {
                        resolve(res.data);
                    })
                    .catch(err => {
                        reject(err);
                    });
            });
        }
    }
};